package com.hc.fdkforwarders.service;

import com.hc.fdkforwarders.dao.SellerFetchOrderDao;
import com.hc.fdkforwarders.param.PrintLableParam;
import com.hc.fdkforwarders.service.base.BaseService;
import com.hc.fdkforwarders.vo.NumSumListQueryVO;
import com.hc.fdkforwarders.vo.NumSumListVO_2;
import com.hc.fdkforwarders.vo.PrintLabelVO;
import com.hc.fdkforwarders.vo.PrintLabelVO_1;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SellerFetchOrderService extends BaseService {

    @Resource
    SellerFetchOrderDao sellerFetchOrderDao;

    public NumSumListVO_2 showGoodsListS(NumSumListQueryVO numSumListQueryVO){
        NumSumListVO_2 numSumListVO_2 = new NumSumListVO_2();
        numSumListVO_2.setList(sellerFetchOrderDao.showGoodsList(numSumListQueryVO));
       return numSumListVO_2;
    }

    public PrintLabelVO_1 printAllLabel(PrintLableParam param){
        PrintLabelVO_1 printLabelVO_1 = new PrintLabelVO_1();
        List<PrintLabelVO> list = sellerFetchOrderDao.printLabel(param);
        for (PrintLabelVO printLabelVO : list) {
            if(printLabelVO.getStatus() == 1){
                sellerFetchOrderDao.updateStatus(printLabelVO.getBarcode(), new Byte("2"));
                sellerFetchOrderDao.updateTagPrintFlag(printLabelVO.getBarcode(), new Byte("1"));
            }
        }
        printLabelVO_1.setLabelList(list);
        return printLabelVO_1;
    }

}
